import request from '@/utils/request'


// 新增登记
export function add(data) {
  
  return request({
    url: '/customer/add',
    method: 'post',
    data:data  
  })
}

//拜访记录
export function addVisit(data) {
  
  return request({
    url: '/customer/addVisit',
    method: 'post',
    data: data
  })
}

//新增开票信息
export function addInvoiceForm(data) {
  return request({
    url: '/customer/addInvoiceForm',
    method: 'post',
    data: data
  })
}
// 修改登记
export function update(data) {
  console.log("--------------------------------")
  console.log(data)
  return request({
    url: '/customer/update',
    method: 'post',
    data: data
  })
}

// 查询合同的客户有关的开票信息
export function queryMesBycustomerName(customerName){
  return request({
    url: '/customer/queryMesBycustomerName',
    method: 'post',
    params: { customerName }
  })
}


// 查询合同的客户有关的开票信息
export function queryCustomerInvoiceByClientName(clientName){
  return request({
    url: '/customer/queryCustomerInvoiceByClientName',
    method: 'post',
    params: { clientName }
  })
}

// 查询合同的客户有关的开票信息
export function queryStartDateByContractNumber(contractCode){
  return request({
    url: '/customer/queryStartDateByContractNumber',
    method: 'post',
    params: { contractCode }
  })
}

// 查询定时任务调度列表
export function selectInvoiceByContractNumber(contractCode){
  return request({
    url: '/customer/selectInvoiceByContractNumber',
    method: 'post',
    params: { contractCode }
  })
}

// 查询定时任务调度列表
export function list(query){
  return request({
    url: '/customer/list',
    method: 'get',
    params: query
  })
}
// 查询定时任务调度列表
export function visitList(query){
  return request({
    url: '/customer/visitList',
    method: 'get',
    params: query
  })
}

// 修改定时任务调度
export function updateJob(data) {
  return request({
    url: '/monitor/job',
    method: 'put',
    data: data
  })
}
// 修改定时任务调度
export function updateVisit(data) {
  return request({
    url: '/customer/updateVisit',
    method: 'post',
    data: data
  })
}

// 查询记录
export function getDetail(customerCode) {
  return request({
    url: '/customer/getDetail',
    method: 'post',
    params: { customerCode } 
  })
}




// 删除定时任务调度
export function delCustomer(customerCode) {
  return request({
    url: '/customer/' + customerCode,
    method: 'delete'
  })
}

// 任务状态修改
export function changeJobStatus(jobId, status) {
  const data = {
    jobId,
    status
  }
  return request({
    url: '/monitor/job/changeStatus',
    method: 'put',
    data: data
  })
}


// 定时任务立即执行一次
export function runJob(jobId, jobGroup) {
  const data = {
    jobId,
    jobGroup
  }
  return request({
    url: '/monitor/job/run',
    method: 'put',
    data: data
  })}
